Mission toolkit v3
Summary Provides a library of scripts for # launching with atmosphere and in vacuum (ltoa, ltov). Staging to be managed using when commands from the main script. # landing orbit with periapsis 30 degree off the zenith (landnode). Enables landing on the sunny side. # land in vacuum (landv), same script for Mun and Minmus # highly accurate maneuver node execution program (exenode). Better than 0.1% deltav accuracy. # orbital maneuvering (aponode, perinode) # Kerbin maneuvers for Mun and Minmus (soinode) # inclination maneuvers for Minmus transfer (incnode) # Mun and Minmus escape maneuvers to return to Kerbin on a low deltav trajectory (krbnode) The scripts rely on physics and math to calculate the maneuver properties. Usually 2D there will be some vector math in the inclination and landing node scripts. Requirements Works with KSP 0.23.5 and kOS 12.2p1 What's new? # Kerbin - Mun/Minmus transfer and return node creation # orbit inclination adjustment # ascent w/o atmosphere # descent & landing w/o atmosphere # warpinsoi, warpoutsoi and warpdist scripts to wait for an soi change # exenode script improvements for better accuracy Mun & Minmus mission scripts Kerbal Automated Mission Challenge scripts. The Minmus missions illustrate how to customize the mission scripts for specific vessels. Mun mission # Vessel: Mun Lander 1b #: run kamc0. // outbound #: run kamc1. // return Minmus mission "Wikinger" # This vessels' stage 2 separation requires two stage statements. # You'll know why I call it "Viking" when you see the lander. # Vessel: Minmus Lander 1b #: run kamc2. // outbound #: run kamc4. // return Minmus mission 2 # This vessels' stage 2 separation requires one stage statements. # Vessel: Minmus Lander 1c #: run kamc3. // outbound #: run kamc4. // return Known issues # When planet and moon are aligned with the sun it may happen that the lander travels in the planet's or moon's shadow for prolonged times during transfer. During those periods of travel in the dark the battery may run empty and shut down the kOS module due to lack of electricity. This will stop the script and require manual restarting of the mission script to execute the remaining commands. Launch & Landing scripts Launch to Orbit / Atmosphere :: run ltoa. # Thrust limited by max q during ascent. Max q defaults to 7000. # Gravity turn: pitch depending on cos(altitude). Default: start at 1.000, ends at 50.000. I found these parameters to use least fuel. Can you configure it better? # Staging separated from trajectory control (thrust/pitch). Staging to be implemented in main script using when clauses. # Compensating for atmospheric drag when coasting to apoapsis. # Time warp while coasting to apoapsis. # Calculation of target velocity for circular orbit using aponode. Launch to Orbit / Vacuum :: run ltov. # Thrust limited during initial ascent until craft points to the horizon. Thrust limit shall prevent reaching low orbit altitude during first 2 seconds (this is a problem on Minmus). # Gravity turn delayed by 2 seconds to gain some altitude (non-quantitative). Turn will reduce pitch to the horizon compensated for gravitation (which is approx 1 degree on Mun). # Staging separated from trajectory control (thrust/pitch). Staging to be implemented in main script using when clauses. # Time warp while coasting to apoapsis. # Calculation of target velocity for circular orbit using aponode. Land / Vacuum :: run landv(ecoh). // ecoh: engine cut-off height # Landing script works in four phases loosely based on the real Apollo mission descent planning: ## deceleration from orbit (retrograde burn) until 1/4 of periapsis velocity or radar altimeter starts working ## retrograde burn while reducing velocity proportional to radar altitude ## high gate (150m): descend and reduce surface velocity (thrusting downwards angled towards surface velocity vector) ## low gate (15m and surface velocity is less than 0.1m/s): descend vertically for landing # downward vertical velocity builds only through gravity (in contrast to the Apollo lander which thrusted upward to build downward velocity early in the burn). # engine cut-off when landing gear almost touches the ground. Implemented using the control unit's radar altitude on the ground (ecoh parameter). Node Runner :: run exenode. # Maneuver node execution script # Mission toolkit node scripts assume impulsive burns, i.e. deltav happens instantly. Of course, this is not possible, but the node runner script runs the engines at full throttle to achieve shortest possible burn times. # The script will ## warp to 1min before burn ## orient the ship for the burn ## warp to burn ## burn full throttle, then ## for very accurately changing deltav (better 0.1%) throttle down nearing burn end. # Workhorse of any mission script. Usually used alternating with maneuver node generator scripts. Orbital Maneuvering Apoapsis maneuver :: run aponode(altitude). # create maneuver node at apoapsis for changing periapsis altitude Periapsis maneuver :: run perinode(altitude). # create maneuver node at periapsis for changing apoapsis altitude # See also: http://en.wikipedia.org/wiki/Oberth_effect Landing orbit maneuver :: run landnode(altitude). # Lowers periapsis to altitude # Assumes a circular orbit # Periapsis will be 30 degrees "after" the zenith (orbitwise) on the dayside of the body. In that position potential pilots and observers will have a good lighting conditions to view the vessel (no beams needed) and its shadow to judge altitude. Inclination adjustment :: run incnode(tgtbody). # Adjusts the orbits inclination to match tgtbodies' orbit inclination around the central body. # Assumes a circular orbit Intraplanetary Transfers Intraplanetary Hohmann outbound transfer :: run hohnode(tgtbody). # creates a maneuver node for Kerbin to Mun or Minmus Hohmann transfer # requires a circular orbit # apoapsis defaults to half of the target bodies' soi # for Minmus transfers detects whether Mun is in the way. The script then delays the maneuver for one orbit (until Mun is no longer in the way). # maneuver angle is calculated based on: ## Hohmann transfer time ## target bodies' orbital period Intraplanetary Hohmann inbound transfer :: run krbnode(peri_radius). # creates a maneuver node for Mun or Minmus to Kerbin return Hohmann transfer # the peri_radius parameter is the periapsis radius for the target body, NOT the periapsis altitude. peri_radius = planet_radius + periapis (altitude). This is to allow usage with other planets. The planets radius is injected as a parameter and does not need to be "guessed" by the program. # requires a circular orbit # more tricky since as a first step the moon's soi must be left, i.e. an escape trajectory # maneuver is setup to leave the moon's soi ## opposite of the moon's direction of travel ## velocity after leaving soi matches an orbit with a) moon's apoapsis and b) periapsis as specified in the parameter. # CAVEAT: it seems like the moon's frame of reference is rotating. Thus an ejection angle of 90 degrees does lead to a distorted velocity vector once leaving the soi! I have solved this by calibrating the ejection angle. Warping by duration :: run warpfor(secs). # warps for duration until sunrise :: run warpday. # warps until sunrise by distance :: run warpdist(refbody, dist). # warps until passing distance dist relative to refbody # automatically recognizes whether to warp in or out # determines velocity to/from refbody by measuring distance change regularly. The measurement time interval depends on the current warp factor. # used by soi warp programs until entering soi :: run warpinsoi(tgtbody). # warps until entering soi of tgtbody # current body is used as refbody # tgtbody is required to positively recognize new soi until leaving soi :: run warpoutsoi(refbody, tgtbody). # TODO: to be changed to run warpoutsoi. to simplify interface. Parameters are not needed. # warps until leaving soi of a body # refbody is required to calculate distance (even after leaving soi) # tgtbody is used to positively recognize new soi Miscellaneous Body properties database :: run bodyprops. # Sets a body's properties global variables. A.k.a. "body database" by other kOS developers. Loads body specific properties for the current body. # currently works for Kerbin, Mun and Minmus. Check vessel compatibility :: run checkvessel(vesselname). # checks for a match of the vesselname # intended for the mission script to check whether used with a compatible vessel # remember: the mission script encodes staging behavior in when..then commands Turn to sun :: run tts. # turns the vessel facing 90 degress from the sun # makes sure simple solar cells receive light # baloan: I had vessels running out of electricity because maneuver burn vectors accidentally were oriented towards the sun or away. Sphere of influence :: run soi(refbody). # return the refbody's soi in the soi variable # is required by the intraplanetary maneuver scripts # it does NOT use a database but calculates using the body:mu values. See also SOI Prepare :: run prep. # copied to the ship's local volume 1 when the mission scripts start # contains initialization to restart scripts after a KSP restart; currently just switches to volume 0 and runs bodyprops Steer :: run steer. # wait for ship to orient, then return # deprecated. to be removed in next mission toolkit # see tts Planned extensions # warp to lunar position which avoids prolonged transfer in the dark (without light for the solar cells) # interplanetary transfers # docking (requires kOS thruster support) Download files * aponode.txt * bodyprops.txt * checkvessel.txt * exenode.txt * hohnode.txt * incnode.txt * kamc0.txt * kamc1.txt * kamc2.txt * kamc3.txt * kamc4.txt * krbnode.txt * landa.txt * landnode.txt * landv.txt * ltoa.txt * ltov.txt * perinode.txt * prep.txt * soi.txt * soinode.txt * steer.txt * tts.txt * warpday.txt * warpdist.txt * warpfor.txt * warpinsoi.txt * warpoutsoi.txt * The wiki doesn't like spaces in external links so you have to look for the craft file for yourself here: craft file directory Baloan